﻿

using System;
using Demo.Domain;
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations.Schema;

namespace Demo.Domain
{
    public class UserMapping:EntityTypeConfiguration<User>
    {
        public UserMapping()
        {
            this.HasKey(u => u.UserID).Property(u => u.UserID).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            this.Property(u => u.Name).HasMaxLength(20).IsRequired();
            this.Property(u => u.Password).HasMaxLength(100).IsRequired();
            this.Property(u => u.RoleID).IsRequired();
        }
    }
}
